package com.cc.shiro.demo.exception;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2019-12-16 16:32
 */

@ControllerAdvice
@Slf4j
public class MyExceptionHandler {
    //AuthorizationException.class, UnauthorizedException.class}
    @ExceptionHandler({AuthorizationException.class,UnauthorizedException.class})
    public String handler1(Exception e){
        log.info("该用户没授权！！");
        return "login";
    }
//    @ExceptionHandler(UnauthorizedException.class)
//    public String handler2(Exception e){
//        log.info("该用户没授权！！");
//        return "login";
//    }
}
